from redis import Redis, ConnectionPool


def Count(Service, host, port):
    pool = ConnectionPool(host=host, port=port)
    rdb = Redis(connection_pool=pool)
    status = rdb.get(Service)
    if status:
        count = int(status) + 1
        rdb.setrange(Service, 0, count)
        return count
    else:
        rdb.set(Service, 1)
        rdb.expire(Service, 60)
        return 1
